package com.oa.aop;

import com.oa.vo.SysResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLException;

/**
 * @author Administrator
 */
@Slf4j
@RestControllerAdvice
public class SystemAOP {
    @ExceptionHandler({RuntimeException.class, SQLException.class})
    public SysResult exception(Exception e){
        e.printStackTrace();
        log.info("异常类型为: {}", e.getMessage());
        return SysResult.fail();
    }
}
